Socket
Book a DemoInstallSign in
Socket

filename-regex

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

filename-regex

Regular expression for matching file names, with or without extension.

Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

filename-regex NPM version

Regular expression for matching file names, with or without extension.

Install with npm

npm i filename-regex --save

Usage

The regex is returned as a function.

var regex = require('filename-regex');

var match = 'abc/xyz.md'.match(regex());
//=> match[0] = 'xyz.md'
//=> match[1] = 'xyz'
//=> match[2] = '.md'

var match = 'abc/xyz'.match(regex());
//=> match[0] = 'xyz'
//=> match[1] = 'xyz'
//=> match[2] = ''

var match = 'abc/.gitignore'.match(regex());
//=> match[0] = '.gitignore'
//=> match[1] = ''
//=> match[2] = '.gitignore'

Run tests

Install dev dependencies:

node i -d && mocha

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

Author

Jon Schlinkert

License

Copyright (c) 2014 Jon Schlinkert
Released under the MIT license

This file was generated by verb on December 28, 2014.

Keywords

base

FAQs

Package last updated on 28 Dec 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts